﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QDebug>
#include <QNetworkReply>
#include <QProcess>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    QString oldVersion;
    QString newVersion;
    QString appUrl;

protected:
    void showEvent(QShowEvent *event) override;
    void setupNewApp();

private:
    Ui::Widget *ui;

public slots:
    void onDownloadFinished(QNetworkReply *reply);
    void onUninstallFinished(int exitCode, QProcess::ExitStatus exitStatus);
    void onInstallFinished(int exitCode, QProcess::ExitStatus exitStatus);
    void onDownloading(qint64 bytesReceived, qint64 bytesTotal);
    void onOkClicked();
    void onCancelClicked();
};
#endif // WIDGET_H
